Title: Sell Only to Specific States/Provinces/Regions with WooCommerce

Publish Date: Mon, 08 Dec 2014 18:46:09 +0000

Categories: Uncategorized

Content:

WooCommerce allows you to sell only to specific countries, like Italy or the United States.But how can you sell only in a specific province or California, for example?



In this guide I will show you how to use custom code to limit the regions, provides, and states allowed on Checkout.







There's a little snippet of code to add to your site. In this example, I want to sell only in California, so I need to update the states dropdown on the checkout page to include only that state.





To do so, open your functions.php file located in wp-content/themes/your-theme-name/ and add this code at the end of the file:




https://gist.github.com/SiR-DanieL/af36d7fecfbcc219aabe5a3537dd58b5




This code will limit the states to only California in the dropdown on your checkout page.



If you need a list of all the states, regions, provinces, and counties available in WooCommerce, you can find them in wp-content/plugins/woocommerce/i18n/states/.
